package com.crm.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.Max;

import org.hibernate.annotations.GenericGenerator;
import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.annotation.JsonFormat;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@Entity
@Table(name = "users")
@ApiModel("用户")
public class Users implements Serializable{
	
	private static final long serialVersionUID = 1L;

	@Id
    @GenericGenerator(name = "system-uuid", strategy = "uuid2")
    @GeneratedValue(generator = "system-uuid")
    @ApiModelProperty(value = "用户id", required = true, hidden = true)
    private String id;
    
    @ApiModelProperty(value = "用户名称", required = true)
	private String name;
    
    @ApiModelProperty(value = "用户密码", required = false)
    private String password;
    
    @ApiModelProperty(value = "用户性别", required = true)
    @Max(1)
	private String sex;
    
    @ApiModelProperty(value = "用户年龄", required = true)
	private Integer age;
    
	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
	@DateTimeFormat
    @ApiModelProperty(value = "用户生日", required = false)
	private Date brith;
    
    @ApiModelProperty(value = "用户地址", required = true)
	private String addr;
    
    @ApiModelProperty(value = "用户是否有效",hidden = true)
    private boolean flag;
    
    @ApiModelProperty(value = "用户头像",hidden = true)
    private String img;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}


	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public Integer getAge() {
		return age;
	}

	public void setAge(Integer age) {
		this.age = age;
	}

	public Date getBrith() {
		return brith;
	}

	public void setBrith(Date brith) {
		this.brith = brith;
	}

	public String getAddr() {
		return addr;
	}

	public void setAddr(String addr) {
		this.addr = addr;
	}
	
	public boolean isFlag() {
		return flag;
	}

	public void setFlag(boolean flag) {
		this.flag = flag;
	}

	public String getImg() {
		return img;
	}

	public void setImg(String img) {
		this.img = img;
	}

	@Override
	public String toString() {
		return "Users [id=" + id + ", name=" + name + ", password=" + password + ", sex=" + sex + ", age=" + age
				+ ", brith=" + brith + ", addr=" + addr + ", flag=" + flag + "]";
	}

	
}
